import axios from '~/axios'
import { queryParams } from '~/composables/util'
// 获取订单列表
export function getOrderList(page, query = {}) {
    // 将对象转换为url拼接需要的
    let r = queryParams(query)
    return axios.get(`/admin/order/${page}${r}`)
}
// 批量删除订单列表
export function deleteOrderList(ids) {
    ids = Array.isArray(ids) ? ids : [ids]
    return axios.post(`/admin/order/delete_all`, { ids })
}
// 订单发货
export function shipOrderList(id, data) {
    return axios.post(`/admin/order/${id}/ship`, data)
}
// 拒绝 / 同意退款
export function refundOrder(id, data) {
    return axios.post(`/admin/order/${id}/handle_refund`, data)
}
// 导出订单
export function excelexportOrder(query = {}) {
    let r = queryParams(query)
    return axios.post(
        `/admin/order/excelexport${r}`,
        {},
        {
            responseType: 'blob'
        }
    )
}
// 获取快递公司列表
export function getexpressCompanyList() {
    return axios.get(`/admin/express_company/1`)
}
// 查看订单物流信息
export function getShipInfo(id) {
    return axios.get(`/admin/order/${id}/get_ship_info`)
}
